console.log(`---NODE_ENV:${process.env.NODE_ENV}`)
const isDev = process.env.NODE_ENV === 'development'

enum UserRole {
  NoVerifyEmail = 'visitor', // 未验证邮箱
  User = 'user', // 普通用户
  Admin = 'admin', // 管理员
  SuperAdmin = 'superAdmin', // 超级管理员
}

enum LoginType {
  WeChat = 100, // 微信登录
  Email, // 邮箱登录
  Name, // 用户名登录
}
export default class Config {
  // 服务器端口
  public static readonly http_port = 9000
  /** 接口前缀 */
  public static readonly api_prefix = '/api/v1/'

  /** 上传图片存放目录 */
  public static readonly upload_path = 'public/upload/images/'

  /** 上传图片大小限制 */
  public static readonly upload_img_size = 5 * 1024 * 1024

  /** 根目录 */
  public static readonly base = isDev ? 'src' : 'dist/src'

  // 用户权限等级
  public static readonly UserRole = UserRole

  public static readonly security = {
    //token key 配置
    secretKey: 'abcdefg', //key
    expiresIn: 60 * 60 * 24 * 0.5, //过期时间
  }
  // 用户登录方式
  public static readonly LoginType = LoginType

  public static readonly clientURL = 'http://localhost:8080'

  public static readonly wx = {
    appId: 'wx494fa336e358211d',
    appSecret: '5237858979272bd4ebf1e8f264ae5b16',
    loginUrl:
      'https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code',
  }
}
